package thread_test;
//消费者
public class Consumer extends Thread{
    Stack stack = null;

    public Consumer(Stack stack) {
        this.stack = stack;
    }

    @Override
    public void run(){
        while (true){
            System.out.println("消费者消费了一个商品");
            Object o = stack.Pop();
            if(o==null){
                System.out.println("消费者没有消费到商品");
            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
